package freespiritsocial.io.user.weight

import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import androidx.cardview.widget.CardView
import androidx.core.widget.NestedScrollView

/**
 * @description
 * @author csw
 * @date 2022-01-10
 */
class MapCardView @JvmOverloads constructor(context: Context,attrs: AttributeSet? = null): CardView(context,attrs) {
    var scrollView: NestedScrollView? = null

    override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
        if (ev.action == MotionEvent.ACTION_UP || ev.action == MotionEvent.ACTION_CANCEL) {
            scrollView?.requestDisallowInterceptTouchEvent(false)
        } else {
            scrollView?.requestDisallowInterceptTouchEvent(true)
        }
        return false
    }

    override fun onTouchEvent(event: MotionEvent?): Boolean {
        return true
    }
}